from django.db import models
from django.contrib.auth.models import User



class Profile (models.Model):
    user = models.OneToOneField (User, related_name = 'profile');


class LottoBet (models.Model):
    date = models.DateTimeField ();
    quantity = models.PositiveSmallIntegerField ();
    profile = models.ForeignKey (Profile, related_name = 'lotto');
    n1 = models.PositiveSmallIntegerField ();
    n2 = models.PositiveSmallIntegerField ();
    n3 = models.PositiveSmallIntegerField ();
    n4 = models.PositiveSmallIntegerField ();
    n5 = models.PositiveSmallIntegerField ();
    n6 = models.PositiveSmallIntegerField ();
    
    def from_data (self, date, quantity, profile, nums):
        self.date = date;
        self.quantity = quantity;
        self.profile = profile;
        self.n1 = nums[0];
        self.n2 = nums[1];
        self.n3 = nums[2];
        self.n4 = nums[3];
        self.n5 = nums[4];
        self.n6 = nums[5];
    
    def as_list (self):
        return [self.n1, self.n2, self.n3, self.n4, self.n5, self.n6];
    
    def as_str (self):
        return '%s\t%s\t%s\t%s\t%s\t%s' % (self.n1, self.n2, self.n3, self.n4, self.n5, self.n6);
    
    def to_str (self):
        return 'Lotto';


class MiniLottoBet (models.Model):
    date = models.DateTimeField ();
    quantity = models.PositiveSmallIntegerField ();
    profile = models.ForeignKey (Profile, related_name = 'minilotto');
    n1 = models.PositiveSmallIntegerField ();
    n2 = models.PositiveSmallIntegerField ();
    n3 = models.PositiveSmallIntegerField ();
    n4 = models.PositiveSmallIntegerField ();
    n5 = models.PositiveSmallIntegerField ();
    
    def from_data (self, date, quantity, profile, nums):
        self.date = date;
        self.quantity = quantity;
        self.profile = profile;
        self.n1 = nums[0];
        self.n2 = nums[1];
        self.n3 = nums[2];
        self.n4 = nums[3];
        self.n5 = nums[4];
    
    def as_list (self):
        return [self.n1, self.n2, self.n3, self.n4, self.n5];
    
    def as_str (self):
        return '%s\t%s\t%s\t%s\t%s' % (self.n1, self.n2, self.n3, self.n4, self.n5);
    
    def to_str (self):
        return 'Mini Lotto';


class MultiMultiBet (models.Model):
    date = models.DateTimeField ();
    quantity = models.PositiveSmallIntegerField ();
    profile = models.ForeignKey (Profile, related_name = 'multimulti');
    n1 = models.PositiveSmallIntegerField ();
    n2 = models.PositiveSmallIntegerField ();
    n3 = models.PositiveSmallIntegerField ();
    n4 = models.PositiveSmallIntegerField ();
    n5 = models.PositiveSmallIntegerField ();
    n6 = models.PositiveSmallIntegerField ();
    n7 = models.PositiveSmallIntegerField ();
    n8 = models.PositiveSmallIntegerField ();
    n9 = models.PositiveSmallIntegerField ();
    n10 = models.PositiveSmallIntegerField ();
    
    def from_data (self, date, quantity, profile, nums):
        self.date = date;
        self.quantity = quantity;
        self.profile = profile;
        self.n1 = nums[0];
        self.n2 = nums[1];
        self.n3 = nums[2];
        self.n4 = nums[3];
        self.n5 = nums[4];
        self.n6 = nums[5];
        self.n7 = nums[6];
        self.n8 = nums[7];
        self.n9 = nums[8];
        self.n10 = nums[9];
    
    def as_list (self):
        return [self.n1, self.n2, self.n3, self.n4, self.n5, self.n6, self.n7, self.n8, self.n9, self.n10];
    
    def as_str (self):
        return '%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s' % (self.n1, self.n2, self.n3, self.n4, self.n5, self.n6, self.n7, self.n8, self.n9, self.n10);
    
    def to_str (self):
        return 'Multi Multi';


class KaskadaBet (models.Model):
    date = models.DateTimeField ();
    quantity = models.PositiveSmallIntegerField ();
    profile = models.ForeignKey (Profile, related_name = 'kaskada');
    n1 = models.PositiveSmallIntegerField ();
    n2 = models.PositiveSmallIntegerField ();
    n3 = models.PositiveSmallIntegerField ();
    n4 = models.PositiveSmallIntegerField ();
    n5 = models.PositiveSmallIntegerField ();
    n6 = models.PositiveSmallIntegerField ();
    n7 = models.PositiveSmallIntegerField ();
    n8 = models.PositiveSmallIntegerField ();
    n9 = models.PositiveSmallIntegerField ();
    n10 = models.PositiveSmallIntegerField ();
    n11 = models.PositiveSmallIntegerField ();
    n12 = models.PositiveSmallIntegerField ();

    def from_data (self, date, quantity, profile, nums):
        self.date = date;
        self.quantity = quantity;
        self.profile = profile;
        self.n1 = nums[0];
        self.n2 = nums[1];
        self.n3 = nums[2];
        self.n4 = nums[3];
        self.n5 = nums[4];
        self.n6 = nums[5];
        self.n7 = nums[6];
        self.n8 = nums[7];
        self.n9 = nums[8];
        self.n10 = nums[9];
        self.n11 = nums[10];
        self.n12 = nums[11];
    
    def as_list (self):
        return [self.n1, self.n2, self.n3, self.n4, self.n5, self.n6, self.n7, self.n8, self.n9, self.n10, self.n11, self.n12];
    
    def as_str (self):
        return '%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s' % (self.n1, self.n2, self.n3, self.n4, self.n5, self.n6, self.n7, self.n8, self.n9, self.n10, self.n11, self.n12);
    
    def to_str (self):
        return 'Kaskada';


class JokerBet (models.Model):
    date = models.DateTimeField ();
    quantity = models.PositiveSmallIntegerField ();
    profile = models.ForeignKey (Profile, related_name = 'joker');
    jr = models.PositiveSmallIntegerField ();
    
    def from_data (self, date, quantity, profile, nums):
        self.date = date;
        self.quantity = quantity;
        self.profile = profile;
        self.jr = nums[0];
    
    def as_list (self):
        return [self.jr];
    
    def as_str (self):
        return '%s' % self.jr;
    
    def to_str (self):
        return 'Joker';
